package com.cqjtu.tto.controller;

import com.cqjtu.tto.service.TaskService;
import com.cqjtu.tto.vo.Results;
import com.cqjtu.tto.vo.params.TaskVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "任务模块")
public class TaskController {
    @Autowired
    TaskService taskService;

    @PostMapping("addTasks")
    @ApiOperation(value = "添加任务")
    public Results addTasks(@RequestBody List<TaskVo> taskVos) throws InterruptedException { return taskService.addTask(taskVos);}

    @PostMapping("TaskScore")
    @ApiOperation(value = "任务评分")
    public Results TaskScore(Long user_id, Long task_id,Integer task_score,String task_evaluation){ return taskService.TaskScore(user_id,task_id,task_score,task_evaluation);}

    @PostMapping("Endtask")
    @ApiOperation(value = "结束任务")
    public Results Endtask(Long user_id,Long task_id){return taskService.Endtask(user_id,task_id);}
}
